import sys
from PyQt6.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QPushButton, QVBoxLayout


class MyWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.button = None
        self.input_box = None
        self.label = None
        self.initUI()

    def initUI(self):
        # 创建标签
        self.label = QLabel('请输入内容', self)

        # 创建输入框
        self.input_box = QLineEdit(self)

        # 创建按钮
        self.button = QPushButton('显示内容', self)
        self.button.clicked.connect(self.show_text)

        # 创建垂直布局
        layout = QVBoxLayout()
        layout.addWidget(self.label)
        layout.addWidget(self.input_box)
        layout.addWidget(self.button)

        # 设置布局
        self.setLayout(layout)

        # 设置窗口属性
        self.setWindowTitle('简单可视化界面')
        self.setGeometry(0, 0, 1300, 650)

    def show_text(self):
        text = self.input_box.text()
        self.label.setText(f'你输入的内容是: {text}')


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MyWindow()
    window.show()
    sys.exit(app.exec())
